package com.tledu.day62springboot.config;

import com.shangyun.ShangYunUtils;
import com.tledu.day62springboot.other.TestService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author cyrus
 */
//@Configuration
public class CommonConfig {
    @Bean
    // 配置文件中必须有这个配置，这个Bean才会注入
//    @ConditionalOnProperty("student.custom")
    // Ioc容器中有指定的Bean，当前Bean才会注入
//    @ConditionalOnBean(ShangYunUtils.class)
    // 没有指定Bean的时候，当前Bean才会注入
//    @ConditionalOnMissingBean(ShangYunUtils.class)
    // 当环境里有指定类的时候，当前Bean才会注入
//    @ConditionalOnClass(name = "com.shangyun.ShangYunUtils")
    public TestService testService() {
        return new TestService();
    }

}
